package com.ksyun.seckill.constants;


/**
 *
 * 抢购订单状态.
 *
 * @author ksc
 */
public enum PurchaseOrderStatus {

    INIT(1, "未核销"),

    CONSUMED(2, "已核销"),

    EXPIRED(3, "已过期"),

    //如黑产，一键作废资格.
    INVALID(4, "已作废");

    public final Integer status;

    public final String descr;

    PurchaseOrderStatus(Integer status, String descr) {
        this.status = status;
        this.descr = descr;
    }

    public static PurchaseOrderStatus of(final Integer status) {
        PurchaseOrderStatus[] statuses = values();
        for (PurchaseOrderStatus purchaseOrderStatus : statuses) {
            if (purchaseOrderStatus.status.equals(status)) {
                return purchaseOrderStatus;
            }
        }
        throw new IllegalArgumentException("不合法的PurchaseOrderStatus:" + status);
    }

}

